IF exists(SELECT * FROM dbo.sysobjects WHERE name='LeerlingenMondialevorming12Overzicht' AND xtype='V') 
BEGIN
	DROP VIEW LeerlingenMondialevorming12Overzicht
END
GO

CREATE view LeerlingenMondialevorming12Overzicht
as
select l.*,l.voornaam+' '+l.achternaam as volleNaam,
        v.keuze1 as keuze1vm,
        v.keuze2 as keuze2vm,
	v.keuze3 as keuze3vm,
	v.keuze4 as keuze4vm,
n.keuze1 as keuze1nm,
n.keuze2 as keuze2nm,
n.keuze3 as keuze3nm,
n.keuze4 as keuze4nm,
 
v.definitief as defv,n.definitief as defn
from mondialevorming12 as v left join
mondialevorming12NM as n
on v.inschrijvingsNr=n.inschrijvingsNr
left join leerlingen as l on
l.inschrijvingsNr=v.inschrijvingsNr